<template>
  <div>
    <el-row>
      <el-col :span="24">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item label="角色名称：">
            <el-input v-model="current" style="width: 200px"></el-input>
          </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="onSubmit" icon="el-icon-search"
              >查询</el-button
            >
          </el-form-item>
          <el-form-item>
            <el-button type="success" icon="el-icon-plus" @click="addition(1)"
              >新增</el-button
            >
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="date" label="序号"> </el-table-column>
      <el-table-column prop="name" label="角色名称"> </el-table-column>
      <el-table-column prop="address" label="描述"> </el-table-column>
      <el-table-column prop="setDate" label="创建日期"> </el-table-column>
      <el-table-column label="操作" width="180" align="center">
        <template #default="scope">
          <el-button
            type="primary"
            size="mini"
            @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button
          >
          <el-button type="danger" size="mini">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      :title="single"
      v-model="plassets"
      width="30%"
      :close-on-click-modal="false"
    >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="角色名称">
          <el-input style="width: 300px" v-model="form.pattern"></el-input>
        </el-form-item>
        <el-form-item label="数据权限"> </el-form-item>
        <el-form-item label="描述">
          <el-input
            style="width: 300px"
            v-model="form.addnote"
            type="textarea"
            :rows="2"
          ></el-input>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="plassets = false">取 消</el-button>
          <el-button type="primary" v-if="under == 1" @click="determine()"
            >确 定</el-button
          >
          <el-button @click="hardware()" v-else type="primary"
            >编辑 确 定</el-button
          >
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      permissions: "",
      plassets: false,
      single: "",
      under: 1,
      current: "",
      formInline: {
        current: "",
      },
      form: {
        pattern: "",
        addnote: "",
      },
      tableData: [
        {
          date: "01",
          name: "超级管理员",
          address: "	-",
          setDate: "2021/5/17",
        },
        {
          date: "02",
          name: "普通用户",
          address: "	-",
          setDate: "2021/5/21",
        },
      ],
    };
  },
  methods: {
    addition(index) {
      this.under = index;
      this.single = "新增";
      this.plassets = true;
    },
    onSubmit() {
      console.log("查询");
    },
    //保存角色
    determine() {
      console.log();
    },
  },
};
</script>

<style scoped>
</style>